const app = getApp();
const Controller = require('../controllers/controllers.js').controller;
const util = require('../../utils/util.js');

Page({
  data: {
    isloading: true,
    id:'',
    timeid:'',
    page:1,
    pageSize:99,
    isEnd:false,
    contentlistdata:[],
  },
  onLoad(option) {
    if(option.id){
      this.setData({
        id:option.id,
        timeid:option.timeid
      })
      this.userList()
    }
  },
  onShow(){
 
  },
  userList(){
    Controller.userList({page:this.data.page,pageSize:this.data.pageSize,activityTimeId:this.data.timeid,activityId:this.data.id}).then(res=>{
      if(res.data.baseData && res.data.baseData.list.length>0){
        this.setData({
          contentlistdata:this.data.contentlistdata.concat(res.data.baseData.list),
        })
      }
      if(res.data.baseData.lastPage){
        this.setData({
          isEnd:res.data.baseData.lastPage
        })
      }
      this.setData({
        isloading:false
      })
    })
  },
  onReachBottom(){
    if(this.data.isEnd){
      return
    }else{
      this.setData({
        page:this.data.page+1
      })
      this.userList()
    }
    
  },
  onPageScroll: function (e) { // 获取滚动条当前位置
    
  },
  onShareAppMessage: function (e) {
    
  },
  onShareTimeline: function(res){
    
  },
})